<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>添加新闻</title>
		<%@include  file="../css.jsp"%>
	
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/css/webuploader.css" />
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/style.css" />
	</head>

	<body>
						<div class="page-header">
							<h1>
								新闻
								<small>
									<i class="icon-double-angle-right"></i>
									添加
								</small>
							</h1>
						</div><!-- /.page-header -->
						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" id="usForm"  method="post" action="" role="form">
									
									<input type="hidden" id="NewsInformationId" name="NewsInformationId" value="${newsInforList.newsInformationId }" />	
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">标题</label>

										<div class="col-sm-9">
											<input type="text" id="Title" name="Title" value="${newsInforList.title }" placeholder="标题" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">发布人</label>

										<div class="col-sm-9">
											<input type="text" id="ReleasePeople" name="ReleasePeople" value="${newsInforList.releasePeople }" placeholder="发布人" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">新闻栏目</label>
										<div class="col-sm-9">
											<input type="hidden" 
											on_type="comboxSelectOne" 
											id="NewsId" 
											name="NewsId"  
											no_name="ColumnName"
											value="${newsInforList.newsId }" 
											loadUrl="${jpath}/NewsContr/findByPage"
											parMs="{}"
											/>
										</div>
									</div>
									<div class="form-group" >
										
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">新闻内容</label>
										
										<div class="col-sm-6">
											<script type="text/javascript" charset="utf-8" src="${jpath}/static/plugins/UEditor/ueditor.config.js"></script>
										    <script type="text/javascript" charset="utf-8" src="${jpath}/static/plugins/UEditor/ueditor.all.min.js"> </script>
											<script type="text/javascript" charset="utf-8" src="${jpath}/static/plugins/UEditor/lang/zh-cn/zh-cn.js"></script>
											<script id="editor" type="text/plain" style="width:100%;height:400px;"></script>
											<script type="text/javascript">
    											var ue = UE.getEditor('editor');
    										</script>
										</div>
									    <label class="col-sm-3"></label>
									</div>
									<div class="">
										<input type='hidden' id='AttachmentId' name='AttachmentId'  value=""/>
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">附件</label>
										<div class="col-sm-6 ">
											<div id="wrapper" style="margin: 0 0 1rem -0.4rem !important ;">
										        <div id="container">
										            <!--头部，相册选择和格式选择-->
										            <div id="uploader">
										                <div class="queueList">
										                    <div id="dndArea" class="placeholder">
										                        <div id="filePicker"></div>
										                        <p>或将照片拖到这里，单次最多可选300张</p>
										                    </div>
										                </div>
										                <div class="statusBar" style="display:none;">
										                    <div class="progress">
										                        <span class="text">0%</span>
										                        <span class="percentage"></span>
										                    </div>
										                    <div class="info"></div>
										                    <div class="btns">
										                        <div id="filePicker2"></div>
										                        <div class="uploadBtn">开始上传</div>
										                    </div>
										                </div>
										            </div>
										        </div>
										    </div>
									    </div>
									    <label class="col-sm-3"></label>
									</div>
									<div class="clearfix form-actions" style="background-color:  #E4E6E9">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" id="submitBtn"  type="button">
												<i class="icon-ok bigger-110"></i>
												提交
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" id="ss" type="reset">
												<i class="icon-undo bigger-110"></i>
												刷新
											</button>
										</div>
									</div>

								</form>
							</div><!-- /.col -->
						</div><!-- /.row -->
<%@include  file="../js.jsp"%>


<script type="text/javascript" src="${jpath}/static/plugins/webuploader/dist/webuploader.js"></script>
<script type="text/javascript" src="${jpath}/static/plugins/webuploader/upload.js"></script>
<script type="text/javascript">
	$(function(){
	
		
		$("#usForm").loadCombox("comboxSelectOne");
		
		$("#submitBtn").click(function(){
			var contentpar={};
			var content=UE.getEditor('editor').getContentTxt();
			contentpar.NewsContent=content;
			var jsonForms=getForm("#usForm");
			var jsonF=$.extend(contentpar,jsonForms);
			
			$.post("${jpath}/NewsInforContr/UpdateOrAdd",jsonF,function(data){
					console.log(data);
					var json=$.parseJSON(data);
					$("#ss").click();
					alert(json.resMsg);
					location.href="${jpath}/NewsInforContent";
				}
			);
		});
	});

	
</script>
</body>
</html>
